import 'dart:convert';

import 'package:flutter2/generated/json/base/json_field.dart';
import 'package:flutter2/generated/json/sheet_item_entity.g.dart';
import 'package:flutter2/ui/sheet.dart';

export 'package:flutter2/generated/json/sheet_item_entity.g.dart';

@JsonSerializable()
class SheetItemEntity extends SheetItem {
  @JSONField(name: "benefitsailorsuspect")
  String code = '';
  @JSONField(name: "fridgesuck")
  String value = '';

  SheetItemEntity();

  SheetItemEntity.from(this.code, this.value);

  factory SheetItemEntity.fromJson(Map<String, dynamic> json) => $SheetItemEntityFromJson(json);

  Map<String, dynamic> toJson() => $SheetItemEntityToJson(this);

  bool isNotNull() {
    return value.isNotEmpty && code.isNotEmpty;
  }

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  String getName() {
    return value;
  }
}
